
$(document).ready(function () {	
	findPlanById();	
	$('#delEB').click(function () {
		delPlanById();
	});
});

function delPlanById(myself){	
	var timestamp = Date.parse(new Date());
	$.get("lzm/Plan_delPlanById.action?ts="+timestamp+"&PId="+getCookie(PId),null,delPlanByIdRst);
}

function delPlanByIdRst(data){
	if(data.ajaxRst=SUCCESS){
		alert("删除数据成功");
		window.location.href="find_plan_no_report.jsp";
	}else{
		alert("删除数据失败");
	}
}

function findPlanById(){	
	var timestamp = Date.parse(new Date());
	$.get("lzm/Plan_findPlanById.action?ts="+timestamp+"&PId="+getCookie(PId),null,findPlanByIdRst);
}

function findPlanByIdRst(data){
	var plan=data.tbPlan;
	$('#PName').text(plan.PName);
	$('#planType').text(plan.tbPlanType.ptName);
	$('#planGrade').text(plan.tbPlanGrade.pgName);
	$('#eventType').text(plan.tbEventType.etEventType);
	$('#planScope').text(plan.tbPlanScope.psName);
	$('#planRegion').text(plan.tbPlanRegion.prName);
	$('#PSummary').text(plan.PSummary);
	$('#PUnit').text(plan.PUnit);
	$('#PContractor').text(plan.PContractor);
	$('#PTime').text(plan.PTime.replace(/T/," "));
	$('#PVersion').text(plan.PVersion);	
}